<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
    
    <rich:panel>
        <f:facet name="header">Event</f:facet>



        <s:decorate id="description" template="layout/display.xhtml">
            <ui:define name="label">description</ui:define>
            #{eventHome.instance.description}
        </s:decorate>


        <s:decorate id="name" template="layout/display.xhtml">
            <ui:define name="label">name</ui:define>
            #{eventHome.instance.name}
        </s:decorate>

        <div style="clear:both"/>
        
    </rich:panel>
    
    <div class="actionButtons">      

        <s:button view="/EventEdit.xhtml" 
                    id="edit" 
                 value="Edit"/>

        <s:button view="/#{empty eventFrom ? 'EventList' : eventFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab label="gamesets">
    <div class="association" id="gamesetsChildren">
        
        <h:outputText value="There are no gamesets associated with this event."
                   rendered="#{empty eventHome.gamesets}"/>
        
        <rich:dataTable value="#{eventHome.gamesets}" 
                       var="gameset" 
                  rendered="#{not empty eventHome.gamesets}" 
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="gamesetsTable">
            <h:column>
                <f:facet name="header">id</f:facet>
                <h:outputText value="#{gameset.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">description</f:facet>
                <h:outputText value="#{gameset.description}"/>
            </h:column>
            <h:column>
                <f:facet name="header">name</f:facet>
                <h:outputText value="#{gameset.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link id="selectgameset" 
                     value="Select" 
                      view="/Gameset.xhtml">
                    <f:param name="gamesetId" 
                            value="#{gameset.id}"/>
                    <f:param name="gamesetFrom" value="Event"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    
    <div class="actionButtons">
        <s:button 
               value="Add gameset"
                view="/GamesetEdit.xhtml">
            <f:param name="eventId" 
                    value="#{eventHome.instance.id}"/>
            <f:param name="gamesetFrom" value="Event"/>
        </s:button>
    </div>        
    </rich:tab>

    <rich:tab label="player">
    <div class="association" id="playerParent">
        
        <h:outputText value="There is no player associated with this event." 
                   rendered="#{eventHome.instance.player == null}"/>
        
        <rich:dataTable var="player" 
                   value="#{eventHome.instance.player}" 
                rendered="#{eventHome.instance.player != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="playerTable">
            <h:column>
                <f:facet name="header">id</f:facet>
                #{player.id}
            </h:column>
            <h:column>
                <f:facet name="header">name</f:facet>
                #{player.name}
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link id="viewplayer" 
                     value="View" 
                      view="/Player.xhtml">
                    <f:param name="playerId" 
                           value="#{player.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
